package entities;

import menu.Settings;

import org.newdawn.slick.GameContainer;
import org.newdawn.slick.SlickException;

import util.Vector2D;

public class FollowingEnemy extends Enemy {

	private Entity target;

	public FollowingEnemy(Entity target) throws SlickException {
		super("res/enemies/enemy05.png");
		image = image.getScaledCopy(70, 35);
		destroyOffScreenX = false;
		destroyOffScreenY = false;
		friction = 1.0f;
		maxHealth = (int) (4 * Settings.getfactor());
		health = maxHealth;
		score = 100;
		this.target = target;
	}

	@Override
	public void update(GameContainer gc, int delta) {
		super.update(gc, delta);
		if (target.isAlive()) {
		Vector2D targetPos = target.pos;
		acceleration = (targetPos.subtract(pos)).getUnitVector().scale(500);
		}
		
		// Vector2D dv = force.scale(delta);
		// System.out.println(dv.getX());
		// velocity = velocity.add(dv);
	}

	@Override
	public String getName() {
		return null;
	}

}
